#define MAX_BANKS (16)


#define MEM_TYPE (0)
#define IO_TYPE (1)

#ifdef SUCCESS
#undef SUCCESS
#define SUCCESS (1)
#else 
#define SUCCESS (1)
#endif

#ifdef FAILURE
#undef FAILURE
#define FAILURE (-1)
#else
#define FAILURE (-1)
#endif

typedef struct mem_state {
	unsigned int* rom[MAX_BANKS];
//	unsigned int rom_start_addr[MAX_BANKS];
	unsigned int rom_size[MAX_BANKS];
} mem_state_t;

typedef struct mem_bank{
	unsigned int start_addr;
	unsigned int size;

	int (*bank_write)(unsigned int size,int offset, unsigned int value);
	int (*bank_read)(unsigned int size,int offset, unsigned int *result);

	unsigned int type;
} mem_bank_t;


typedef struct mem_config {
	unsigned int total_bank_num;
	mem_bank_t mem_banks[MAX_BANKS];
} mem_config_t;



unsigned int mem_init(void);
